<template>
  <rx-layout>
    <div slot="center">
      <rx-fit>
        <div slot="toolheader" style="padding-bottom: 10px;" foldbtn="false">
          <span style="font-size: 16px;padding-top: 8px;display: inline-block;">{{i18n('list.comment2','系统参数配置')}}</span>
          <div style="float: right">
            <a-button type="primary" icon="save" @click="handleSave">{{$ti18('rxForm.saveBtn','保存')}}</a-button>
          </div>
        </div>
        <!--mode只是一种展示样式，与内容是什么无关-->
        <rx-codemirror ref="nacosConfig" v-model="content" :mode="'sql'"></rx-codemirror>
      </rx-fit>
    </div>
  </rx-layout>

</template>

<script>
  import SysPropertiesApi from '@/api/system/core/sysProperties';

  export default {
    name: "SysPropertiesConfig",
    data() {
      return {
        content: "",
      }
    },
    created() {
      this.getConfig();
    },
    methods: {
      i18n(name,text,key){
          return this.$ti18(name,text,"SysFileStore",key);
      },
      getConfig() {
        SysPropertiesApi.getConfig().then(res => {
          this.content = res.message;
        })
      },
      handleSave() {
        SysPropertiesApi.publish(this.content).then(res => {
        });
      },
    },
    watch: {
    }
  }
</script>

<style>
  .codemirror {
    font-size: 1rem;
    height: 700px;
    width: 100%;
  }
</style>